/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utility;

import common.FornituraEstesa;
import java.util.Iterator;
import java.util.LinkedList;

/**
 *
 * @author Antonio
 */
public class ListFornituraEstesa extends LinkedList<FornituraEstesa> {

    private FornituraEstesa fornitura;

    @Override
    public boolean add(FornituraEstesa e) {

        Iterator<FornituraEstesa> it = this.iterator();

        while (it.hasNext()) {

            fornitura = it.next();

            if (fornitura.getFornitura().getProdotto().equals(e.getFornitura().getProdotto())) {

                this.remove(fornitura);
                break;
            }
        }

        return super.add(e);
    }
}
